package org.csmzxy.class2333;

import java.io.File;
import java.io.IOException;

public class Example03 {
    public static void main(String[] args) throws IOException {
        File f1 = new File("C:\\Users\\Administrator.pc-PC\\Desktop\\Java-Course-Job\\张宁桂-38\\Chapter16\\src\\file\\itheima.txt");
        if (f1.exists()) {
            System.out.println("删除文件itheima.txt：" + f1.delete());
        }else  {
            System.out.println("创建文件夹ithima.txt：" + f1.createNewFile());
        }

        File f2 = new File("C:\\Users\\Administrator.pc-PC\\Desktop\\Java-Course-Job\\张宁桂-38\\Chapter16\\src\\file\\aaa");
        System.out.println("创建目录aaa：" + f2.mkdir());

        File f3 = new File("C:\\Users\\Administrator.pc-PC\\Desktop\\Java-Course-Job\\张宁桂-38\\Chapter16\\src\\file\\aaa\\Hello.docx");
        if (f3.exists()) {
            System.out.println("删除文件Hello.docx：" + f3.delete());
        }else {
            System.out.println("在目录aaa下创建文件Hello.docx" + f3.createNewFile());
        }
    }
}
